<template>
  <Modal v-model="rulesPop" width="30" :closable="false" :mask-closable="false" class-name="vertical-center-modal">
    <div slot="header" class="head-sty">
      <div class="title">{{ $t('user.tip_title') }}</div>
      <div></div>
    </div>
    <div class="content-text">{{ textStr }}</div>
    <div slot="footer" class="footer-wrap">
      <div class="cancel-text" @click="closeMet()">{{ closeText }}</div>
      <div class="confirm-text" @click="confirmMet()">{{ confirmText }}</div>
    </div>
  </Modal>
</template>
<script>
export default {
  data() {
    return {
      rulesPop: false,
      textStr: '',
      confirmText: '',
      closeText: '',
      noticeType: 1,//外部区分操作
      type: 1
    }
  },
  methods: {
    open(str, closeText = '', confirmText = '', noticeType = 1, type) {
      this.textStr = str;
      this.confirmText = confirmText || this.$t('personal.Search-confirm');
      this.closeText = closeText || this.$t('pay.cancel');
      this.noticeType = noticeType || 1;
      this.type = type;//用于判断是新增还是编辑 1是新增2是编辑
      this.rulesPop = true;
    },
    closePop() {
      this.rulesPop = false;
    },
    closeMet() {
      this.closePop();
      this.$emit('closeEmit', this.noticeType, this.type);
    },
    confirmMet() {
      this.closePop();
      this.$emit('confirmEmit', this.noticeType, this.type);
    }
  }
}
</script>

<style lang="less" scoped>
:deep(.ivu-modal-content) {
  border-radius: 12px;

  .ivu-modal-header {
    border: none;
    padding: 32px 32px 0 32px;
  }

  .ivu-modal-body {
    padding: 8px 32px 44px 32px;
  }

  .ivu-modal-footer {
    border: none;
    padding: 16px 32px 24px 32px;
  }
}

.vertical-center-modal {
  display: flex;
  align-items: center;
  justify-content: center;

  .head-sty {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .title {
      font-weight: 600;
      font-size: 24px;
      color: #1E1714;
      line-height: 28px;
    }
  }

  .content-text {
    font-family: PingFang SC, PingFang SC;
    font-weight: 500;
    font-size: 20px;
    color: #767B93;
    line-height: 23px;
    margin-top: 40px;
    margin-bottom: 12px;
  }

  .footer-wrap {
    display: flex;
    justify-content: end;
    gap: 24px;

    .cancel-text {
      min-width: 112px;
      text-align: center;
      height: 46px;
      padding: 12px 24px;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid #E5E5E5;
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 16px;
      color: #1E1714;
      line-height: 19px;
      cursor: pointer;
    }

    .confirm-text {
      min-width: 112px;
      text-align: center;
      height: 46px;
      padding: 12px 40px;
      background: #FF186B;
      border-radius: 8px 8px 8px 8px;
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 16px;
      color: #FFFFFF;
      line-height: 19px;
      cursor: pointer;
    }
  }
}
</style>
